home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earcd / grafica / ghostscript / 5.10 / data / pcharstr.ps < prev    next >
Text File  |  1997-09-11  |  4KB  |  128 lines

  1. %    Copyright (C) 1990, 1992, 1997 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % pcharstr.ps
  16. % Print the CharStrings and Subrs (if present) from a Type 1 font,
  17. % in either a PostScript-like or a C-compatible form,
  18. % depending on whether CSFormat is defined as /PS or /C.
  19.  
  20. % Load the Type 1 utilities.
  21. (type1ops.ps) run
  22.  
  23. % Define the printing procedures for PostScript-like output.
  24. /pcs_ps_dict mark
  25.   /, {( ) print}
  26.   /charname {==only}
  27.   /csbegin {}
  28.   /beginchars {(%---------------- CharStrings\n) print}
  29.   /charbegin {==only}
  30.   /char1 {( ) print ==only}
  31.   /endchars {}
  32.   /beginsubrs {(%---------------- Subrs\n) print}
  33.   /subrbegin {=only}
  34.   /endsubrs {}
  35.   /beginboxes {(%---------------- Encoding & metrics\n) print}
  36.   /notdefbox {}
  37.   /boxbegin {=only ( ) print}
  38.   /boxend {(\n) print}
  39.   /endboxes {(%----------------\n) print}
  40. .dicttomark readonly def
  41.  
  42. % Define the printing procedures for C-like output.
  43. /pcs_c_dict mark
  44.   /, {(, ) print}
  45.   /charname {(") print =only (") print}
  46.   /csbegin {counttomark =only ,}
  47.   /beginchars {(\nconstdata int CSCharData[] = {\n) print}
  48.   /charbegin {pop}
  49.   /char1 {=only ,}
  50.   /endchars {
  51.     (-1\n};\nconstdata char *CSCharNames[] = {\n) print
  52.     CharStrings {pop charname ,} forall (0\n};\n) print
  53.   }
  54.   /beginsubrs {(\nconstdata int CSSubrs[] = {\n) print}
  55.   /subrbegin {pop}
  56.   /endsubrs {(-1\n};\n) print}
  57.   /beginboxes {(\nconstdata type1_box CSboxes[] = {\n) print}
  58.   /notdefbox {(  {""},\n) print}
  59.   /boxbegin {pop (  {) print}
  60.   /boxend {(},) =}
  61.   /endboxes {(  {0}\n};\n) print}
  62. .dicttomark readonly def
  63.  
  64. /printcs
  65.  { dup type /stringtype eq
  66.     { printcs1 (\n) print }
  67.     { ( ) print == }
  68.    ifelse
  69.  } bind def
  70. /printcs1
  71.  { save exch
  72.    lenIV 0 ge {
  73.      4330 exch dup length string .type1decrypt exch pop
  74.      dup length lenIV sub lenIV exch getinterval
  75.    } if
  76.    0 () /SubFileDecode filter
  77.    mark exch charstack_read csbegin
  78.    counttomark 1 sub -1 0 { index char1 } for
  79.    cleartomark restore
  80.  } bind def
  81.  
  82. /printfont
  83.  { pcs_ps_dict
  84.    /CSFormat where { pop CSFormat /C eq { pop pcs_c_dict } if } if
  85.    begin
  86.    currentfont begin Private begin 10 dict begin
  87.  
  88.     % Print the CharStrings and Subrs
  89.  
  90.    beginchars
  91.    CharStrings { exch charbegin printcs } forall
  92.    endchars
  93.    /Subrs where
  94.     { pop    % the dictionary
  95.       beginsubrs
  96.       0 1 Subrs length 1 sub
  97.        { dup subrbegin
  98.          Subrs exch get printcs
  99.        } for
  100.       endsubrs
  101.     } if
  102.  
  103.     % Print the bounding boxes
  104.  
  105.    gsave nulldevice FontMatrix matrix invertmatrix concat
  106.    beginboxes
  107.    0 1 Encoding length 1 sub
  108.     { dup Encoding exch get dup /.notdef eq
  109.        { pop pop notdefbox
  110.        }
  111.        { 1 index boxbegin charname ,
  112.          ( ) dup 0 4 -1 roll put
  113.          newpath 0 0 moveto false charpath
  114.      pathbbox ({) print 4 -1 roll =only ,
  115.      3 -1 roll =only , exch =only , =only (}) print
  116.          boxend
  117.        }
  118.       ifelse
  119.     } for
  120.    endboxes
  121.    grestore
  122.  
  123.    end end end end
  124.  } bind def
  125.